//Ϣ
		function SavePlugs()
		{	
			foreach( $this->ArrPlugs as $Key=>$Val )
			{	
				if( ( $this->ViewerInfo[$Key] == '0' && $Val[allownull] == false ) || ( $this->NewViewer == false && $Val[newviewer] == true ) )
				{					
					continue;
				}
				
				$this->_SavePlugs( $Key );
			}
		}
		
		function _SavePlugs( $Type )
		{
			$Types = &$this->ArrPlugs;
			
			if( ! isset( $Types[$Type] ) )
			{
				return false;
			}

			$Sql = " select count(plugid) as count, types, counts, plugid from " . $this->TableList[plug] . " where plug = '" . $this->ViewerInfo["$Type"] . "' and types != 2 and types != 3 and types != 4 and types != 5 and website = '$this->website' and plug != '0' group by types,plugid,counts ";
			$Res = @$this->_query( $Sql );

			unset( $DelData );
			unset( $Data );
			
			while( $Tmp = $Res->FetchRow() )
			{		
				if( isset( $Data["$Tmp[types]"] ) )
				{	
					$Tmp['isset'] = $Data["$Tmp[types]"];
					$DelData[] = $Tmp;
					continue;
				}
				$Data["$Tmp[types]"] = $Tmp;
			}

			//ǷҪӵļ¼
			for( $i = 0; $i < 2; $i++ )
			{
				if( ! isset( $Data[$i] ) )
				{
					$Sql = "INSERT INTO " . $this->TableList[plug] . " ( `website`,`plug`, `times`,"  . ( $Types[$Type][lastpage] ?  "`lastpage`," : '' ) . " `counts`, `types` ) VALUES ( '$this->website','" . $this->ViewerInfo["$Type"] . "', '{$this->ViewerInfo[TIME]}', " . ( $Types[$Type][lastpage] ?  "'{$this->ViewerInfo[REFERER]}', " : '' ) . "'0', '$i' );";
					@$this->_query( $Sql );					
				}
			}
			

			//ǷҪɾļ¼
			if( count( $DelData ) > 0 )
			{	
				foreach( $DelData as $Val )
				{	
					$Sql = " delete from " . $this->TableList[plug] . " where plugid = " . $Val["plugid"] ." and website = '$this->website'";
					@$this->_query( $Sql );
					$Sql = " update " . $this->TableList[plug] . " set counts = counts + $Val[counts] where plugid = " . $Val['isset']["plugid"]." and website = '$this->website'";
					@$this->_query( $Sql );
				}
			}

			$Sql = " update " . $this->TableList[plug] . " set counts = counts + 1, "  . ( $Types[$Type][lastpage] ?  "lastpage='{$this->ViewerInfo[REFERER]}', " : '' ) . "times = '{$this->ViewerInfo[TIME]}' where plug = '" . $this->ViewerInfo["$Type"] . "'  and types != 2  and types != 3 and types != 4 and types != 5 and website = '$this->website'";			
			@$this->_query( $Sql );

		}
